package com.warm.system.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.warm.common.DBTypeEnum;
import com.warm.common.DS;
import com.warm.system.entity.User;
import com.warm.system.mapper.OrderMapper;
import com.warm.system.mapper.UserDao;
import com.warm.system.model.ModelTest1;
import com.warm.system.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;


@Service
public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserService {
    @Autowired
    private OrderMapper orderMapper;
    @Autowired
    private UserDao userDao;
    @Override
    public List<User> getUserList() {
        return selectList(null);
    }

    @DS(DBTypeEnum.db2)
    @Override
    public BigDecimal getOrderPriceByUserId(Integer userId) {
        return orderMapper.getPriceByUserId(userId);
    }

	@Override
	@Transactional
	public void save(User user) {
		super.baseMapper.insert(user);
//		int i = 1/0;
	}

	@Override
	public ModelTest1 find1() {
		// TODO Auto-generated method stub
		return userDao.findTest1();
	}
}
